
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        医生管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="css/main.css" media="all">
    <script type="text/javascript" src="lib/loading/okLoading.js"></script>
    <!--百度编辑器-->
    <script src="ueditor/ueditor.config.js"></script>
    <script src="ueditor/ueditor.all.min.js"></script>
    <script src="ueditor/lang/zh-cn/zh-cn.js"></script>

</head>
<style>
    .imgs{display: none;}
    .picture{display: none;}
</style>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>医生管理</cite></a>
              <a><cite>添加医生信息</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form layui-form-pane" action="" id="add">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <!--<ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
                <li>SEO信息</li>
                <li>栏目内容</li>
            </ul>-->
            <div class="layui-tab-content" >
                <div class="layui-tab-item layui-show">
                    <!--<form class="layui-form layui-form-pane" action="" id="add">-->
                    <input type="hidden" name="id" value="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red' >*</span>用户名
                        </label>
                        <div class="layui-input-block">
                            <input type="text"  id="userName" name="userName" autocomplete="off" placeholder="用户名"
                                   class="layui-input" required="" lay-verify="required" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" >
                            <span class='x-red' >*</span>密码
                        </label>
                        <div class="layui-input-block">
                            <input type="text" id="password" name="password" autocomplete="off" placeholder="密码"
                                   class="layui-input" required="" lay-verify="required" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>年龄
                        </label>
                        <div class="layui-input-block">
                            <input type="text" id="age" name="age" autocomplete="off" placeholder="年龄"
                                   class="layui-input" lay-verify="required" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>科室
                        </label>
                        <div class="layui-input-block">
                            <input type="text" id="clinic" name="clinic" autocomplete="off" placeholder="科室"
                                   class="layui-input" lay-verify="required" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" >
                            <span class='x-red'>*</span>候诊数
                        </label>
                        <div class="layui-input-block">
                            <input type="text" id="access" name="access" autocomplete="off" placeholder="候诊数"
                                   class="layui-input" lay-verify="required" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>真实姓名
                        </label>
                        <div class="layui-input-block">
                            <input type="text" id="realName" name="realName" autocomplete="off" placeholder="真实姓名"
                                   class="layui-input" lay-verify="required" value="">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <button class="layui-btn" type="submit" lay-filter="add" lay-submit="">
                            保存
                        </button>
                    </div>
                    <!--</form>-->
                    <div style="height:100px;"></div>
                </div>

            </div>

        </div>

    </form>
</div>
<script src="lib/layui/layui.js" charset="utf-8"></script>
<script src="js/x-layui.js" charset="utf-8"></script>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('content',{initialFrameWidth:700,initialFrameHeight:200,});
</script>
<script>
    layui.use(['element','layer','form'], function(){
        $ = layui.jquery;//jquery
        lement = layui.element();//面包导航
        layer = layui.layer;//弹出层
        form = layui.form();
        okLoading.close($);

        //监听提交
        form.on('submit(add)', function(data){
            var userName=$("input[name='userName']").val();
            var password=$("input[name='password']").val();
            var age=$("input[name='age']").val();
            if(userName===""){
                layer.msg('用户名不能为空',{icon:5,time:2000});return false;
            }
            if(password===""){
                layer.msg('密码不能为空',{icon:5,time:2000});return false;
            }
            if(age===""){
                layer.msg('年龄不能为空',{icon:5,time:2000});return false;
            }
            var form=data.field;
            $.ajax({
                async:false,
                type:"post",
                url:"/doctor/addDoctor",
                data:form,
                error: function (){
                    alert("添加错误")
                },
                success:function(res)
                {
                    if(res.state === 200) {
                        alert("添加成功，请刷新页面")

                    }
                }

            });
            this.load("/index.html")
        });

    })
</script>

</body>
</html>